#-*- coding:utf-8 -*-
import sqlconnect




def deletebymac(mac):
    db = sqlconnect.connect()
    cursor = db.cursor()
    sql = "delete from blue_info where asset_mac = %s;"
    cursor.execute(sql,[mac])
    db.commit()
    print "delete",mac
    cursor.close()
    db.close()

# 根据Mac获取相应的厂商信息
def MAC_To_Conpany(mac):
    #mac[0:7]
    db = sqlconnect.connect()
    cursor = db.cursor()
    sql = "select cname from c_n where name=(select company from dic_mac_company where mac = %s)"
    cursor.execute(sql, [mac[0:8]])
    companyname=cursor.fetchone()
    #print companyname
    db.close()
    return companyname
if __name__ == '__main__':
    #aa = 'D4:10:E9:6B:46:A5'
    #deletebymac(aa)
    MAC_To_Conpany('AC:BC:32:98:C9:14')